const jwt = require('jwt-simple');
const secretKey = "juseSecretKey";

module.exports = function (openid, userid, phone) {
    const payload = {
        userid: userid,
        openid: openid,
        phone: phone,
        exp: Date.now() + 30 * 60 * 1000
    };
    try {
        return jwt.encode(payload, secretKey);
    } catch (error) {
        throw new Error(error);
    }
}
